#include <stdio.h>

int main(void) {
	int M, N;
	int a[100][100];
	scanf("%d%d", &M, &N);
	for (int i = 0; i < M; i++) {
		for (int j = 0; j < N; j++)
			scanf("%d", &a[i][j]);
	}
	for (int i = 0; i < M; i++) {
		for (int j = 0; j < N - 1; j++) {
			for (int l = j + 1; l < N; l++)
				if (a[i][j] > a[i][l]) {
					a[i][j] = a[i][j] ^ a[i][l];
					a[i][l] = a[i][j] ^ a[i][l];
					a[i][j] = a[i][j] ^ a[i][l];
				}
		}
	}
	for (int i = 0; i < M; i++) {
		for (int j = 0; j < N; j++) {
			if (j < N - 1)
				printf("%d ", a[i][j]);
			else
				printf("%d", a[i][j]);
		}
		if (i < M - 1)
			printf("\n");
	}
}